#include <string>
#include <iomanip>

#include "Log.h"
#include "../Parallel/ParallelMPI.h"

Log::Log(ParallelMPI* pmpi)
{
    if(pmpi->isMaster())
    {
        logging::add_console_log
        (
            //std::cout,
            //keywords::format =
            //(
            //    expr::stream<<std::setw(10)<<expr::smessage
            //)
        );
    }

    std::string log_file_name = "data/log/log.hedpic." + to_string(pmpi->getRank());
    if(pmpi->isMaster())
    {
        log_file_name = "data/log.hedpic." + to_string(pmpi->getRank());
    }

    logging::add_file_log(log_file_name, keywords::auto_flush = true);
    logging::core::get()->set_filter(logging::trivial::severity>=logging::trivial::info);
}
